home *** CD-ROM | disk | FTP | other *** search
/ PCNet 2006 April / PCnet 2006-06.4.iso / shareware / nmsetup.exe / WebServer / web / _network_map.php < prev    next >
Encoding:
PHP Script  |  2006-05-01  |  14.4 KB  |  238 lines

  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // <!--Copyright (c) 2005 Pure Networks Inc.  All rights reserved.-->
  4. ////////////////////////////////////////////////////////////////////////////////
  5. //
  6. // Build: 3.0.6121.0 (Stable)
  7. // $Revision: #3 $
  8. //
  9. if ($bNetworkMap || $bLoggedIn)
  10. {
  11.                     // only get the list of devices if we have not already AND if the user is logged in
  12.                     if ($bLoggedIn)
  13.                     {
  14.                         if (!isset($nmSharedPlaces))
  15.                         {
  16.                             try
  17.                             {
  18.                                 $nmSharedPlaces = $nmNetworkLib->OpenAllShares();
  19.                             }
  20.                             catch(Exception $ex)
  21.                             {
  22.                                 $nmSharedPlaces = null;
  23.                                 $sErrorHeader = "An Error Occurred.";
  24.                                 log_activity("Attempting nmNetworkLib->OpenAllShares()", "exception", $ex->getMessage());
  25.                             }
  26.                         }
  27.                     }
  28.                     else
  29.                     {
  30.                         $nmSharedPlaces = null;
  31.                     }
  32.                     $j=0;
  33.                     $arShareLocations = null;
  34.                     $arShareLocationsCase = null;
  35.                     $sLastLocation = "";
  36.                     if (count($nmSharedPlaces) > 0)
  37.                     {
  38.                         foreach ($nmSharedPlaces as $share)
  39.                         {
  40.                             if ($share->Location != $sLastLocation)
  41.                             {
  42.                                 $arShareLocations[$j][0] = $share->Location;
  43.                                 $arShareLocations[$j][1] = $share->IsOnline;
  44.                                 $arShareLocationsCase[$j][0] = strtolower($arShareLocations[$j][0]);
  45.                             }
  46.                             $sLastLocation = $share->Location;
  47.                             $j++;
  48.                         }
  49.                         array_multisort($arShareLocationsCase,SORT_ASC, SORT_REGULAR,$arShareLocations);
  50.                     }
  51. $sPanelTableHeader = "site map";
  52. require "_header_panel.php";
  53. ?>
  54.                                         <div class="Computer">
  55.                                             <div class="PublicFolder"> </div>
  56.                                             <div class="FolderName<?php if (($sFolderAccessLevel == "public" && !$bLimitLocations) | !$bLoggedIn) { echo ("Active"); } ?>">
  57.                                                 <a href="/folders/public" alt="Public Folders">Public Home Page</a>
  58.                                             </div>
  59.                                         </div>
  60.  
  61.                                         <?php if ($bLoggedIn)
  62.                                         {
  63.                                         ?>
  64.  
  65.                                         <div><img src="/images/pixel.trans.gif" width="90%" height="8" alt=""/></div>
  66.  
  67.                                         <h2>
  68.                                             <?php
  69.                                             if (!isValidString($sNetworkName))
  70.                                             {
  71.                                                 try
  72.                                                 {
  73.                                                     $nmNetworkLib = new COM("PureNetworks.NetMagic.NmRaNetworkLib");
  74.                                                     $nmNetworkLib->EnsureLoaded();
  75.                                                     $sNetworkName = $nmNetworkLib->NetworkName;
  76.                                                 }
  77.                                                 catch(com_exception $ex)
  78.                                                 {
  79.                                                     $sNetworkName = "(Could not determine the network name)";
  80.                                                     log_activity("Attempting nmNetworkLib->NetworkName", "exception", $ex->getMessage());
  81.                                                     if ($sNavLocation != "error")
  82.                                                     {
  83.                                                         gotoAbs("/error/103/return");
  84.                                                         exit();
  85.                                                     }
  86.                                                 }
  87.                                             }
  88.                                             echo str_replace(" ", " ",truncate_string(htmlspecialchars($sNetworkName), $iNetworkNameTruncateLength, "...", "right", true)) . ":";
  89.                                             ?>
  90.                                         </h2>
  91.                                         <div><img src="/images/pixel.trans.gif" width="90%" height="3" alt=""/></div>
  92.  
  93.                                         <div class="Computer">
  94.                                             <div class="PrivateFolder"> </div>
  95.                                             <div class="FolderName<?php if ($sFolderAccessLevel == "private" && !$bLimitLocations) { echo ("Active"); } ?>">
  96.                                                 <a href="/folders/private" alt="Shared Folders">Shared Folders</a>
  97.                                             </div>
  98.                                         </div>
  99.                                         <?php
  100.                                         }
  101.                                         ?>
  102.                                     <?php
  103.                                     if ($arShareLocations != null)
  104.                                     {
  105.                                         $k = 0;
  106.                                         foreach($arShareLocations as $shareLocation)
  107.                                         {
  108.                                             echo ("<div class=\"Computer\">\r\n");
  109.                                             if ($k == count($arShareLocations) - 1)
  110.                                             {
  111.                                                 echo ("<div class=\"NetworkLineEnd\"> </div>\r\n");
  112.                                             }
  113.                                             else
  114.                                             {
  115.                                                 echo ("<div class=\"NetworkLineStart\"> </div>\r\n");
  116.                                             }
  117.                                         ?>
  118.                                             <div class="ComputerIcon ComputerNM"> </div>
  119.                                             <?php
  120.                                             if ($sLocation == $arShareLocations[$k][0] OR $sLocationLimiter == $arShareLocations[$k][0])
  121.                                             {
  122.                                                 echo ("<div class=\"ComputerNameActive\">\r\n");
  123.                                             }
  124.                                             else
  125.                                             {
  126.                                                 echo ("<div class=\"ComputerName\">\r\n");
  127.                                             }
  128.                                             echo ("<a href=\"/folders/private/" . urlEncodeString($arShareLocations[$k][0]) ."\" alt=\"" . urlEncodeString($arShareLocations[$k][0]) . "\">");
  129.                                             echo str_replace(" ", " ",truncate_string($arShareLocations[$k][0], $iComputerNameTruncateLength, "...", "right", true));
  130.                                             echo ("</a>");
  131.                                             if (!$arShareLocations[$k][1])
  132.                                             {
  133.                                                 echo (" (offline)");
  134.                                             }
  135.                                         ?>
  136.                                         </div>
  137.                                     </div>
  138.                                         <?php
  139.                                             $k++;
  140.                                         }
  141.                                     }
  142.                                     ?>
  143.                                     <?php
  144.                                         if ($bAutoDetectWebCams || $bAutoDetectUSBCams)
  145.                                         {
  146.                                             ///////////////////////////////////////////////////
  147.                                             // let's get the cameras
  148.                                             ///////////////////////////////////////////////////
  149.                                             try
  150.                                             {
  151.                                                 $nmCameras = array();
  152.                                                 if ($bAutoDetectWebCams && $bAutoDetectUSBCams)
  153.                                                 {
  154.                                                     $nmUSBCameras = $nmNetworkLib->USBCameras;
  155.                                                     if (count($nmUSBCameras) > 0)
  156.                                                     {
  157.                                                         foreach ($nmUSBCameras as $camera)
  158.                                                         {
  159.                                                             $nmCameras[] = $camera;
  160.                                                         }
  161.                                                     }
  162.  
  163.                                                     $nmWebCameras = $nmNetworkLib->WebCameras;
  164.                                                     if (count($nmWebCameras) > 0)
  165.                                                     {
  166.                                                         foreach ($nmWebCameras as $camera)
  167.                                                         {
  168.                                                             $nmCameras[] = $camera;
  169.                                                         }
  170.                                                     }
  171.                                                 }
  172.                                                 else if ($bAutoDetectWebCams)
  173.                                                 {
  174.                                                     $nmCameras = $nmNetworkLib->WebCameras;
  175.                                                 }
  176.                                                 else if ($bAutoDetectUSBCams)
  177.                                                 {
  178.                                                     $nmCameras = $nmNetworkLib->USBCameras;
  179.                                                 }
  180.  
  181.                                                 if (count($nmCameras) > 0)
  182.                                                 {
  183.                                     ?>
  184.                                                     <div class="Computer">
  185.                                                     <div class="WebCamera"> </div>
  186.                                                         <div class="FolderName">
  187.                                                             Cameras
  188.                                                         </div>
  189.                                                     </div>
  190.                                     <?php
  191.                                                     $k = 0;
  192.                                                     foreach ($nmCameras as $camera)
  193.                                                     {
  194.                                                       if ($k == count($nmCameras) - 1)
  195.                                                       {
  196.                                                            echo ("<div class=\"NetworkLineEnd\"> </div>\r\n");
  197.                                                       }
  198.                                                       else
  199.                                                       {
  200.                                                            echo ("<div class=\"NetworkLineStart\"> </div>\r\n");
  201.                                                       }
  202.                                                       echo ("<div class=\"Computer\">");
  203.                                                       echo ("<div class=\"WebCamera\"> </div>");
  204.  
  205.                                                       if ($sNavLocation == "webcamera" && isValidString($sCameraGuid) && $sCameraGuid==$camera->Guid)
  206.                                                       {
  207.                                                           echo ("<div class=\"FolderNameActive\">");
  208.                                                       }
  209.                                                       else
  210.                                                       {
  211.                                                           echo ("<div class=\"FolderName\">");
  212.                                                       }
  213.  
  214.                                                       echo ("<a href=\"/webcamera.php?Guid=" . urlencode($camera->Guid) . "\">" . str_replace(" ", " ",truncate_string($camera->FriendlyName, $iNetworkNameTruncateLength, "...", "right", true)) . "</a>");
  215.                                                       if (!($camera->Online))
  216.                                                       {
  217.                                                           echo (" (offline)");
  218.                                                       }
  219.                                                       echo ("</div>");
  220.                                                       echo ("</div>");
  221.                                                       $k++;
  222.                                                     }
  223.                                                 }
  224.                                             }
  225.                                             catch(Exception $ex)
  226.                                             {
  227.                                                 $nmCameras = null;
  228.                                                 log_activity("Attempting nmNetworkLib->Cameras", "exception", $ex->getMessage());
  229.                                             }
  230.                                         }
  231.                                        ?>
  232.  
  233.                                         <div><img src="/images/pixel.trans.gif" width="90%" height="8" alt=""/></div>
  234. <?php
  235. require "_footer_panel.php";
  236. }
  237.  ?>
  238.